import java.awt.Rectangle;

import me.w70.bot.scripting.Random;
import me.w70.bot.wrappers.RSInterfaces;


public class WelcomeScreen extends Random {
	final static int WELCOME_SCREEN_ID = 378;
	final static int WELCOME_SCREEN_BUTTON_PLAY = 45;

	@Override
	public boolean canRun() {
		return RSInterfaces.getInterfaceGroup(WelcomeScreen.WELCOME_SCREEN_ID).isValid() &&
		!RSInterfaces.getInterfaceGroup(WelcomeScreen.WELCOME_SCREEN_ID)
		.getInterface(89).getText().contains("10.1120.190");
	}


	@Override
	public String getScriptAuthor() {
		return "spooky";
	}

	@Override
	public String getScriptName() {
		return "Welcome Screen";
	}


	public void clickButton() {
		Rectangle pos = new Rectangle(211, 417, 345, 27);

		clickMouse((int) random(pos.getMinX(), pos.getMaxX() - 10),
				(int) random(pos.getMinY(), pos.getMaxY()), true);
	}

	@Override
	public int loop() {
		wait(random(500,1000));
		/*
		RSInterfaces.getInterfaceGroup(WelcomeScreen.WELCOME_SCREEN_ID)
				.getInterface(WelcomeScreen.WELCOME_SCREEN_BUTTON_PLAY).doClick();
		
		*/
		clickButton();
		wait(random(500,1000));
		return -1;
	}


	@Override
	public String getScriptCategory() {
		// TODO Auto-generated method stub
		return "Random";
	}


	@Override
	public String getScriptDescription() {
		// TODO Auto-generated method stub
		return "Closes the welcome screen";
	}

}